package com.zut.edu.fragment;

import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

import com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton;
import com.zut.edu.R;
import com.zut.edu.nfc.WriteTextActivity;
import com.zut.edu.utils.StringUtils;
import com.zut.edu.utils.SystemTTSUtils;

import butterknife.BindView;
import butterknife.ButterKnife;

public class WriteFragment extends Fragment implements View.OnClickListener{

    @BindView(R.id.write_button)
    QMUIRoundButton writebutton;

    public static WriteFragment newInstance(String title){//带参实例
        WriteFragment fragment = new WriteFragment();
        Bundle bundle = new Bundle();
        bundle.putString("title",title);
        fragment.setArguments(bundle);
        return fragment;
    }

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {//显示布局
        View view = inflater.inflate(R.layout.fragment_write,container,false);
        ButterKnife.bind(this,view);
        return view;
    }

    @Override
    public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {//实例化findbyid
        super.onViewCreated(view, savedInstanceState);
        setListener();
    }

    public void setListener(){
        writebutton.setOnClickListener(this);
        writebutton.setChangeAlphaWhenPress(true);
    }
    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.write_button:
                Intent writeactvivty = new Intent(getContext(), WriteTextActivity.class);
                startActivity(writeactvivty);
                break;
        }
    }
}
